'\" te
'\"! tbl|eqn | mmdoc
'\"macro stdmacro
.ds Vn Version 1.2
.ds Dt 24 September 1999
.ds Re Release 1.2.1
.ds Dp Jan 14 18:30
.ds Dm 01 accum.gl 
.ds Xs 43732 7 accum.gl
.TH GLACCUM 3G
.SH NAME
.B "glAccum
\- operate on the accumulation buffer

.SH C SPECIFICATION
void \f3glAccum\fP(
GLenum \fIop\fP,
.nf
.ta \w'\f3void \fPglAccum( 'u
	GLfloat \fIvalue\fP )
.fi

.EQ
delim $$
.EN
.SH PARAMETERS
.TP \w'\fIvalue\fP\ \ 'u 
\f2op\fP
Specifies the accumulation buffer operation.
Symbolic constants
\%\f3GL_ACCUM\fP,
\%\f3GL_LOAD\fP,
\%\f3GL_ADD\fP,
\%\f3GL_MULT\fP,
and
\%\f3GL_RETURN\fP are accepted.
.TP
\f2value\fP
Specifies a floating-point value used in the accumulation buffer operation.
\f2op\fP determines how \f2value\fP is used.
.SH DESCRIPTION
The accumulation buffer is an extended-range color buffer.
Images are not rendered into it.
Rather,
images rendered into one of the color buffers
are added to the contents of the accumulation buffer after rendering.
Effects such as antialiasing (of points, lines, and polygons),
motion blur,
and depth of field can be created
by accumulating images generated with different transformation matrices.
.P
Each pixel in the accumulation buffer consists of
red, green, blue, and alpha values.
The number of bits per component in the accumulation buffer
depends on the implementation. You can examine this number
by calling \%\f3glGetIntegerv\fP four times,
with arguments \%\f3GL_ACCUM_RED_BITS\fP,
\%\f3GL_ACCUM_GREEN_BITS\fP,
\%\f3GL_ACCUM_BLUE_BITS\fP,
and \%\f3GL_ACCUM_ALPHA_BITS\fP.
Regardless of the number of bits per component,
the range of values stored by each component is [\-1,\ 1].
The accumulation buffer pixels are mapped one-to-one with frame buffer pixels.
.P
\%\f3glAccum\fP operates on the accumulation buffer.
The first argument, \f2op\fP,
is a symbolic constant that selects an accumulation buffer operation.
The second argument, \f2value\fP,
is a floating-point value to be used in that operation.
Five operations are specified:
\%\f3GL_ACCUM\fP, \%\f3GL_LOAD\fP, \%\f3GL_ADD\fP,
\%\f3GL_MULT\fP, and \%\f3GL_RETURN\fP.
.P
All accumulation buffer operations are limited
to the area of the current scissor box and applied identically to
the red, green, blue, and alpha components of each pixel.
If a \%\f3glAccum\fP operation results in a value outside the range [\-1,\ 1], 
the contents of an accumulation buffer pixel component are undefined.
.P
The operations are as follows:
.TP 14
\%\f3GL_ACCUM\fP
Obtains R, G, B, and A values
from the buffer currently selected for reading (see \%\f3glReadBuffer\fP).
Each component value is divided by $2 sup n^-^1$,
where $n$ is the number of bits allocated to each color component
in the currently selected buffer.
The result is a floating-point value in the range [0,\ 1],
which is multiplied by \f2value\fP and added to the corresponding pixel component
in the accumulation buffer,
thereby updating the accumulation buffer.
.TP
\%\f3GL_LOAD\fP 
Similar to \%\f3GL_ACCUM\fP,
except that the current value in the accumulation buffer is not used
in the calculation of the new value.
That is, the R, G, B, and A values from the currently selected buffer
are divided by $2 sup n^-^1$,
multiplied by \f2value\fP,
and then stored in the corresponding accumulation buffer cell,
overwriting the current value.
.TP
\%\f3GL_ADD\fP 
Adds \f2value\fP to each R, G, B, and A
in the accumulation buffer. 
.TP
\%\f3GL_MULT\fP 
Multiplies each R, G, B, and A
in the accumulation buffer by \f2value\fP and returns the scaled component
to its corresponding accumulation buffer location.
.TP
\%\f3GL_RETURN\fP 
Transfers accumulation buffer values
to the color buffer or buffers currently selected for writing.
Each R, G, B, and A component is multiplied by \f2value\fP,
then multiplied by $2 sup n^-^1$,
clamped to the range [0,$~2 sup n^-^1 $], and stored
in the corresponding display buffer cell.
The only fragment operations that are applied to this transfer are
pixel ownership,
scissor,
dithering,
and color writemasks.
.P
To clear the accumulation buffer, call \%\f3glClearAccum\fP with R, G, B,
and A values to set it to, then call \%\f3glClear\fP with the
accumulation buffer enabled. 
.SH NOTES
Only pixels within the current scissor box are updated by a
\%\f3glAccum\fP operation.
.SH ERRORS
\%\f3GL_INVALID_ENUM\fP is generated if \f2op\fP is not an accepted value.
.P
\%\f3GL_INVALID_OPERATION\fP is generated if there is no accumulation buffer.
.P
\%\f3GL_INVALID_OPERATION\fP is generated if \%\f3glAccum\fP
is executed between the execution of
\%\f3glBegin\fP and the corresponding execution of \%\f3glEnd\fP.
.SH ASSOCIATED GETS
\%\f3glGet\fP with argument \%\f3GL_ACCUM_RED_BITS\fP
.br
\%\f3glGet\fP with argument \%\f3GL_ACCUM_GREEN_BITS\fP
.br
\%\f3glGet\fP with argument \%\f3GL_ACCUM_BLUE_BITS\fP
.br
\%\f3glGet\fP with argument \%\f3GL_ACCUM_ALPHA_BITS\fP
.SH SEE ALSO
\%\f3glClear(3G)\fP,
\%\f3glClearAccum(3G)\fP,
\%\f3glCopyPixels(3G)\fP,
\%\f3glDrawBuffer(3G)\fP,
\%\f3glGet(3G)\fP,
\%\f3glReadBuffer(3G)\fP, 
\%\f3glReadPixels(3G)\fP,
\%\f3glScissor(3G)\fP,
\%\f3glStencilOp(3G)\fP
